package com.isunland.managesystem.ui;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BasePagerActivity;
import com.isunland.managesystem.entity.CompanyForumType;

/**
 * 对象功能:
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: HuXiaoDan
 * 创建时间: 2017/6/20 10:44
 */
public class AgriculturalForumPagerActivity extends BasePagerActivity {
  private CompanyForumType companyForumType;
  private String from;
  private String jobno;

  @Override protected void onCreate(Bundle arg0) {
    companyForumType = (CompanyForumType) getIntent().getSerializableExtra(
        AgriculturalForumListFragment.EXTRA_VALUE);
    from = getIntent().getStringExtra(AgriculturalForumListFragment.EXTRA_FROM);
    jobno = getIntent().getStringExtra(AgriculturalForumListFragment.EXTRA_JOBNO);
    super.onCreate(arg0);
  }

  @Override protected Fragment createFragmentOne() {
    return AgriculturalForumListFragment.newInstance(companyForumType, from, jobno);
  }

  @Override protected Fragment createFragmentTwo() {
    if (from.equalsIgnoreCase(AgriculturalForumListFragment.TYPE) || from.equalsIgnoreCase(
        AgriculturalForumListFragment.COLLECT_TYPE)) {
      //具体圈子类别显示资深用户
      return AgriculturalMyExpertListFragment.newInstance(companyForumType);
    } else {
      //认证专家
      return new SeniorExpertListFragment();
    }
  }

  @Override protected int[] createTitle() {
    return new int[] { R.string.forumInteract, R.string.askExpert };
  }

  @Override protected void setFixedTitle(boolean isFixedTitle, String fixedTitle) {
    super.setFixedTitle(true, companyForumType.getName());
  }
}
